#ifndef CUSTOM_MANAGER_H
#define CUSTOM_MANAGER_H

#include "export.h"
#include "qtpropertymanager.h"

#include <QMap>
#include <QIcon>

struct API_EXPORT Vec3
{
	Vec3() {};
	Vec3(float x, float y, float z)
	{
		m_nX = x;
		m_nY = y;
		m_nZ = z;
	}

	bool operator==(const Vec3& vec)
	{
		return
			m_nX == vec.m_nX &&
			m_nY == vec.m_nY &&
			m_nZ == vec.m_nZ;
	}

	float m_nX;
	float m_nY;
	float m_nZ;
};

class API_EXPORT Vec3Manager : public QtAbstractPropertyManager
{
	Q_OBJECT
public:
	Vec3Manager(QObject* parent = nullptr);
	~Vec3Manager();

	QtDoublePropertyManager* subDoublePropertyManager() const;

	void setValue(QtProperty* property, const Vec3& val);
	void setMinimum(QtProperty* property, const Vec3& val);
	void setMaximum(QtProperty* property, const Vec3& val);
	void setSingleStep(QtProperty* property, const Vec3& val);

protected:
	void initializeProperty(QtProperty* property) override;
	void uninitializeProperty(QtProperty* property) override;


signals:
	void valueChanged(QtProperty* property, const Vec3& val);

private:
	QtDoublePropertyManager* m_pDoublePropertyManager;

	QMap<const QtProperty*, Vec3> m_mapProperty2Value;

	QMap<const QtProperty*, QtProperty*> m_mapProperty2X;
	QMap<const QtProperty*, QtProperty*> m_mapProperty2Y;
	QMap<const QtProperty*, QtProperty*> m_mapProperty2Z;

	QMap<const QtProperty*, QtProperty*> m_mapX2Property;
	QMap<const QtProperty*, QtProperty*> m_mapY2Property;
	QMap<const QtProperty*, QtProperty*> m_mapZ2Property;
};

#endif